<script type="text/javascript" src="js/note/noteview.js"></script>
<script type="text/javascript">
//点击在某个目录下面写东西
function writecata(){
	var $cid="cata"+$(".cdelete").attr("id");
  var data={id:$cid}
   $.ajax({
		type : "get",
		async : false,
		url : 'noteedit',
		data:data,
		success : function(dates) {
			$('#container').html(dates);
		},
	    error:function(){
	    	alert("失败了")
	    }
	})
	}

//删除目录
function cdelete(){
	if(confirm("删除之后目录下面的笔记全部会删除")){
	var $cid=$(".cdelete").attr("id");
	var data={cid:$cid}
	var url = 'catadelete';
	  $.ajax({
			type : "get",
			async : false,
			url : url,
			data:data,
			timeout : 1000,
			success : function(dates) {
				alert("删除成功")
				window.location.reload();
			},
		    error:function(){
		    	alert("失败了")
		    }
		})
		}
}


function somenotedelete(){
	var array=new Array();
	var sum=null;
	$("input[name='checkbox']:checked").each(function(){
		array.push($(this).attr("id"));
		sum=array.join(';');
	});
	if(confirm("是否要批量删除这些?")){
	 $.ajax({
			type : "get",
			async : false,
			url : 'notesomedelete',
			data:{sum:sum},
			timeout : 1000,
			success : function(dates) {
				alert("删除成功")
				window.location.reload();
			},
		    error:function(){
		    	alert("失败了")
		    }
		})
	}
}
</script>
	<div class="bgc-w box box-primary">
						<!--盒子头-->
						<div class="box-header write">
							<h3 class="box-title">  最近
							</h3>
							<span style="display:none">	
							<a onclick="writecata()">
							<i class="glyphicon glyphicon-edit" style="color:#337ab7">
							</i>
							</a>
							
							<a class="cdelete" onclick="cdelete()">	
							<i class="glyphicon glyphicon-trash" style="color:#337ab7">
							</i>
							</a>
							</span>
							
							
							<div class="box-tools">
								<div class="input-group" style="width: 150px; float: right; top: 1px;">
												<input type="text" class="form-control input-sm pull-right baseKey" value="" placeholder="查找..." id="find">
												<div class="input-group-btn" style="top: -1px;">
													<a class="btn btn-sm btn-default glyphicon glyphicon-search btn-change baseKetsubmit"></a>
												</div>
											</div>
							</div>
						</div>
						
						
						
						<!--盒子身体-->
						<div class="box-body no-padding">
							<div style="padding: 5px;">
								<span class="btn btn-sm btn-default glyphicon glyphicon-unchecked allcheck"></span>
								<div class="btn-group">
									<a class="btn btn-sm btn-default" onclick="somenotedelete()" title="删除"><span class="glyphicon glyphicon-trash"></span></a> 
										
										<a class="btn btn-sm btn-default">
										<span class="glyphicon glyphicon-star-empty choose_collect" data-type="0"></span>
										</a>
									
								</div>
								<a href="" class="btn btn-sm btn-default" title="刷新">
								<i><span class="glyphicon glyphicon-refresh"></span></i></a>
							</div>
							<div id="table" class="table-responsive">
								<table class="table table-hover table-striped">
									<tbody><tr>
										<th scope="col">选择</th>
										<th scope="col">&nbsp;</th>
										<th scope="col" class="paixu thistype" style="color:blue;">类型
									</th>
										<th scope="col">标题</th>
										
<th scope="col"><span class="paixu thistime" style="color:blue;">更新
						</span></th>
										<th scope="col">附件</th>
										<th scope="col"><span class="paixu thisstatus" style="color:blue;">状态
						</span></th>

										<th scope="col">操作</th>
									</tr>
									<tr>
										<td><span class="labels"><label><input type="checkbox" name="checkbox" id="213"><i>✓</i></label></span></td>
													
										<td>
										<span id="213" class="glyphicon glyphicon-star-empty collect"></span>
										</td>
										
										<td>
										<span>
												
												
												共享笔记
										</span></td>
										<td><span>管理的艺术2</span></td>
										<td><span>2019-1-13 3:54:16</span></td>
										<td>
										
										</td>
										<td>
												
												<span class="label label-danger">重要</span>
										</td>
										<td><a onclick="notejump('noteedit2.html','213')" class="label xiugai ">
											<span class="glyphicon glyphicon-edit"></span> 修改</a> 
												
												<a onclick="notejump('noteinfo.html','213')" class="label xiugai info"><span class="glyphicon glyphicon-search "></span> 查看</a>
												
												 <a onclick="{return confirm('删除该记录将不能恢复，确定删除吗？');}" href="notedelete?nid=213" class="label shanchu"><span class="glyphicon glyphicon-remove"></span> 删除</a></td>
								
									</tr>
									<tr>
										<td><span class="labels"><label><input type="checkbox" name="checkbox" id="212"><i>✓</i></label></span></td>
													
										<td>
										<span id="212" class="glyphicon glyphicon-star-empty collect"></span>
										</td>
										
										<td>
										<span>
												
												公司笔记
												
										</span></td>
										<td><span>笔记-公司</span></td>
										<td><span>2019-1-13 3:53:31</span></td>
										<td>
										
										</td>
										<td>
												<span class="label label-info">一般</span>
												
										</td>
										<td><a onclick="notejump('noteedit.html','212')" class="label xiugai ">
											<span class="glyphicon glyphicon-edit"></span> 修改</a> 
												
												<a onclick="notejump('noteinfo.html','212')" class="label xiugai info"><span class="glyphicon glyphicon-search "></span> 查看</a>
												
												 <a onclick="{return confirm('删除该记录将不能恢复，确定删除吗？');}" href="notedelete?nid=212" class="label shanchu"><span class="glyphicon glyphicon-remove"></span> 删除</a></td>
								
									</tr>
									<tr>
										<td><span class="labels"><label><input type="checkbox" name="checkbox" id="211"><i>✓</i></label></span></td>
													
										<td>
										<span id="211" class="glyphicon glyphicon-star-empty collect"></span>
										</td>
										
										<td>
										<span>
												我的笔记
												
												
										</span></td>
										<td><span>mysql存储过程</span></td>
										<td><span>2019-1-13 3:26:44</span></td>
										<td>
										<a style="color:#337ab7;" href="down?nid=211">
										<span class="glyphicon glyphicon-paperclip"></span>
										</a>
										</td>
										<td>
												
												<span class="label label-danger">重要</span>
										</td>
										<td><a onclick="notejump('noteedit.html','211')" class="label xiugai ">
											<span class="glyphicon glyphicon-edit"></span> 修改</a> 
												
												<a onclick="notejump('noteinfo.html','211')" class="label xiugai info"><span class="glyphicon glyphicon-search "></span> 查看</a>
												
												 <a onclick="{return confirm('删除该记录将不能恢复，确定删除吗？');}" href="notedelete?nid=211" class="label shanchu"><span class="glyphicon glyphicon-remove"></span> 删除</a></td>
								
									</tr>
									<tr>
										<td><span class="labels"><label><input type="checkbox" name="checkbox" id="210"><i>✓</i></label></span></td>
													
										<td>
										<span id="210" class="glyphicon glyphicon-star-empty collect"></span>
										</td>
										
										<td>
										<span>
												我的笔记
												
												
										</span></td>
										<td><span>mysql数据类型</span></td>
										<td><span>2019-1-13 3:25:46</span></td>
										<td>
										
										</td>
										<td>
												<span class="label label-info">一般</span>
												
										</td>
										<td><a onclick="notejump('noteedit.html','210')" class="label xiugai ">
											<span class="glyphicon glyphicon-edit"></span> 修改</a> 
												
												<a onclick="notejump('noteinfo.html','210')" class="label xiugai info"><span class="glyphicon glyphicon-search "></span> 查看</a>
												
												 <a onclick="{return confirm('删除该记录将不能恢复，确定删除吗？');}" href="notedelete?nid=210" class="label shanchu"><span class="glyphicon glyphicon-remove"></span> 删除</a></td>
								
									</tr>
								</tbody></table>
							</div>
						</div>
					
					
<div class="box-footer no-padding" style="margin-top: -20px;">
	<div style="padding: 5px;">
		<div id="page" style="background: #fff; border: 0px; margin-top: 0px; padding: 2px; height: 25px;">
			<div style="width: 40%; float: left;">
				<div class="pageInfo" style="margin-left: 5px;">
					共<span>4</span>条 | 每页<span>10</span>条
					| 共<span>1</span>页
				</div>
			</div>
			<div style="width: 60%; float: left;">
				<div class="pageOperation">
				<!--判断是否是第一页  -->
					<a class="btn btn-sm btn-default no-padding tablefirst" disabled="disabled" style="width: 30px; height: 20px;"> <span class="glyphicon glyphicon-backward"></span></a> 
					<a class="btn btn-sm btn-default no-padding tableup" disabled="disabled" style="width: 30px; height: 20px;"> <span class="glyphicon glyphicon-triangle-left"></span></a> 
				<a disabled="disabled" class="btn btn-default no-padding" style="width: 30px; height: 20px;">
						1
				</a>
				<!--判断是否是最后一页  -->
					<a class="btn btn-sm btn-default no-padding tabledown" disabled="disabled" style="width: 30px; height: 20px;"> <span class="glyphicon glyphicon-triangle-right"></span></a> 
					<a class="btn btn-sm btn-default no-padding tablelast" disabled="disabled" style="width: 30px; height: 20px;"> <span class="glyphicon glyphicon-forward"></span></a> 
				</div>
			</div>
		</div>
	</div>
</div>
<script>
		/* 分页插件按钮的点击事件 */
		/* url是从后台接收过来的链接，sort是记录排序规则 */
		$('.tablefirst').on('click',function(){
			 if(true==false){
				 $('.thistable').load('notewrite?page=0&userid=36');
			 }
		});
		$('.tableup').on('click',function(){
			 if(true==false){
				 $('.thistable').load('notewrite?page=-1&userid=36');
			 }
		});
		$('.tabledown').on('click',function(){
			if(true==false){
				$('.thistable').load('notewrite?page=1&userid=36');
			 }
		});
		$('.tablelast').on('click',function(){
			if(true==false){
				$('.thistable').load('notewrite?page=0&userid=36');
			 }
			
		});
		
		/*类型、状态、时间的排序  */
		$('.thistype').on('click', function() {
			if ($(this).children().hasClass('glyphicon-triangle-bottom')) {
				$('.thistable').load('notewrite?type=0&icon=glyphicon-triangle-top');
			} else {
				$('.thistable').load('notewrite?type=1&icon=glyphicon-triangle-bottom');
			}
		});
		$('.thisstatus').on('click', function() {
			if ($(this).children().hasClass('glyphicon-triangle-bottom')) {
				$('.thistable').load('notewrite?status=0&icon=glyphicon-triangle-top');
			} else {
				$('.thistable').load('notewrite?status=1&icon=glyphicon-triangle-bottom');
			}
		});
		$('.thistime').on('click', function() {
			if ($(this).children().hasClass('glyphicon-triangle-bottom')) {
				$('.thistable').load('notewrite?time=0&icon=glyphicon-triangle-top');
			} else {
				$('.thistable').load('notewrite?time=1&icon=glyphicon-triangle-bottom');
			}
		});
		$('.thisvisit').on('click', function() {
			if ($(this).children().hasClass('glyphicon-triangle-bottom')) {
				$('.thistable').load('notewrite?visitnum=0&icon=glyphicon-triangle-top');
			} else {
				$('.thistable').load('notewrite?visitnum=1&icon=glyphicon-triangle-bottom');
			}
		});
		/* 查找 */
		$('.baseKetsubmit').on('click', function() {
			var baseKey = $('.baseKey').val();
			console.log(baseKey);
			$('.thistable').load('notewrite?baseKey='+baseKey+'');
		});
</script>						
</div>
